package cn.ztr.familyalbum.common;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * TODO
 *
 * @author lijunji
 * @date 2020/5/21
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(value = "返回结果")
public class CommonResult<T>
{
    @ApiModelProperty(value = "状态码")
    private Integer code;
    @ApiModelProperty(value = "返回信息")
    private String message;
    @ApiModelProperty(value = "列表数据")
    private T data;

    public CommonResult(ResultCode resultCode,T data)
    {
        this.code = resultCode.code();
        this.message = resultCode.message();
        this.data = data;
    }

    public CommonResult(ResultCode resultCode)
    {
        this.code = resultCode.code();
        this.message = resultCode.message();
    }
}
